package com.lishao.soccer.service.impl;

import com.lishao.soccer.bean.entity.SmUser;
import com.lishao.soccer.bean.entity.TmTeamOpponent;
import com.lishao.soccer.dao.TmTeamOpponentMapper;
import com.lishao.soccer.service.TmTeamOpponentService;

public class TmTeamOpponentServiceImpl implements TmTeamOpponentService {
	TmTeamOpponentMapper tmTeamOpponentMapper;

	public TmTeamOpponent findTeamOpponent(Long teamOpponentId){
		TmTeamOpponent tmTeamOpponent=tmTeamOpponentMapper.selectByPrimaryKey(teamOpponentId);
		return tmTeamOpponent;
	}
	
	public TmTeamOpponent saveTeamOpponent(TmTeamOpponent tmTeamOpponent,SmUser smUser){
		int iResult = 0;
		if(tmTeamOpponent.getRowId()==null||tmTeamOpponent.getRowId()==-1){
			//新增保存
			tmTeamOpponent.setCreatedBy(smUser.getRowId());
			iResult = tmTeamOpponentMapper.insertSelective(tmTeamOpponent);
		}else{
			//修改保存
			tmTeamOpponent.setLastUpdBy(smUser.getRowId());
			iResult = tmTeamOpponentMapper.updateByPrimaryKeySelective(tmTeamOpponent);
		}
		return tmTeamOpponent;
	}
	//get set
	public TmTeamOpponentMapper getTmTeamOpponentMapper() {
		return tmTeamOpponentMapper;
	}

	public void setTmTeamOpponentMapper(TmTeamOpponentMapper tmTeamOpponentMapper) {
		this.tmTeamOpponentMapper = tmTeamOpponentMapper;
	}
}
